import {createBrowserRouter} from 'react-router-dom'
import React from 'react'
import App from '@/App'
import Login from '@/pages/login/Login'
import lazyLoad from '@/hooks/lazyLoad'
import ProtectedRouted from '@/components/ProtectedRouted/ProtectedRoute'

const router=createBrowserRouter([
    {
        path:'/',
        element:<App></App>,
        children:[
            {
                path:'login',element:lazyLoad(React.lazy(()=>import('@/pages/login/Login')))

            },{
                path:'home',element:(
                    <ProtectedRouted>{lazyLoad(React.lazy(()=>import("@/pages/home/Home")))}</ProtectedRouted>
                    
                
                )
            },
            {
                index:true,element:<Login></Login>
            }
        ]
    },{
        path:'/article',
        element:lazyLoad(React.lazy(()=>import('@/pages/article/Article')))
    }
    ,{
        path:'/detail/:id',
        element:lazyLoad(React.lazy(()=>import('@/pages/detail/Detail')))
    }
])
export default router